package com.fr.sort;

public class QuickSort extends ShowSort{
	public static void quickSort(int [] a, int low, int high){
		if(low < high){  
	        int privotLoc = partition(a,  low,  high);  //将表一分为二  
	        quickSort(a,  low,  privotLoc -1);          //递归对低子表递归排序  
	        quickSort(a,   privotLoc + 1, high);        //递归对高子表递归排序  
	    }  
	}
	private static int partition(int a[], int low, int high)  
	{ 
		
		int mid = a [low];
		while(low < high){
			while(low < high && a[high] >= mid){
				high --;
			}
			swap(a, low, high);
			while(low < high && a[low] <= mid){
				low ++;
			}
			swap (a, low, high);
		}
		return low;
	}  
}
